/* @(#)GSOrderCancelQueryAction.java    
 *
 * Project: BUS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   RoadZheng     2006-2-16    建立
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.ArrayList;

import com.hitrust.gs.bean.GSOrderBean;
import com.hitrust.gs.dao.GSBusOrderDAO;
import com.hitrust.gs.dao.GSBusOrderDetailDAO;
import com.hitrust.gs.form.GSBusOrderCancelQueryForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;

public class GSBusOrderCancelQueryAction extends GSBaseAction {

	public String execute(GSBaseForm aForm) throws Exception {	
		GSBusOrderCancelQueryForm tForm = (GSBusOrderCancelQueryForm) aForm;
		String tOrderTempID = tForm.getOrder_tempid();
		//获取订单基本信息
		GSBusOrderDAO tGSOrderBusDAO = new GSBusOrderDAO();
		GSOrderBean tGSOrderBean = tGSOrderBusDAO.getOrderByTempID(tOrderTempID);
		String [] tGSOrderInfo = new String[5];
		tGSOrderInfo[1] = ""; //订单状态
		if(tGSOrderBean != null) {
			tGSOrderInfo[0] = tGSOrderBean.getGs_order_tempid(); //订单编号
			String tOrderStatus = tGSOrderBean.getGs_order_status();	
			if(tOrderStatus != null) {
				if(tOrderStatus.equals("1")) {
					tGSOrderInfo[1] = "申请"; 
				} else if(tOrderStatus.equals("2")) {
					tGSOrderInfo[1] = "初审通过"; 
				} else if(tOrderStatus.equals("3")) {
					tGSOrderInfo[1] = "复审通过"; 
				} else if(tOrderStatus.equals("4")) {
					tGSOrderInfo[1] = "初审未通过"; 
				} else if(tOrderStatus.equals("5")) {
					tGSOrderInfo[1] = "复审未通过"; 
				} else if(tOrderStatus.equals("6")) {
					tGSOrderInfo[1] = "提交"; 
				} else if(tOrderStatus.equals("7")) {
					tGSOrderInfo[1] = "核准"; 
				} else if(tOrderStatus.equals("8")) {
					tGSOrderInfo[1] = "未核准"; 
				} else if(tOrderStatus.equals("9")) {
					tGSOrderInfo[1] = "订货中"; 
				} else if(tOrderStatus.equals("10")) {
					tGSOrderInfo[1] = "订单确认"; 
				} else if(tOrderStatus.equals("11")) {
					tGSOrderInfo[1] = "订单拒绝"; 
				} else if(tOrderStatus.equals("12")) {
					tGSOrderInfo[1] = "交货确认"; 
				} else if(tOrderStatus.equals("13")) {
					tGSOrderInfo[1] = "收款确认"; 
				} else if(tOrderStatus.equals("14")) {
					tGSOrderInfo[1] = "完成"; 
				} else if(tOrderStatus.equals("18")) {
					tGSOrderInfo[1] = "补单"; 
				} else if(tOrderStatus.equals("19")) {
					tGSOrderInfo[1] = "补单确认"; 
				} else if(tOrderStatus.equals("20")) {
					tGSOrderInfo[1] = "退货"; 
				} else if(tOrderStatus.equals("21")) {
					tGSOrderInfo[1] = "取消"; 
				} else if(tOrderStatus.equals("22")) {
					tGSOrderInfo[1] = "作废"; 
				} 
			}
			String tOrderCategory = tGSOrderBean.getGs_order_category();
			tGSOrderInfo[2] = ""; //订单种类
			if(tOrderCategory != null) {
				if(tOrderCategory.equals("0")) {
					tGSOrderInfo[2] = "正常采购";
				} else if(tOrderCategory.equals("1")) {
					tGSOrderInfo[2] = "应急采购";
				} else if(tOrderCategory.equals("2")) {
					tGSOrderInfo[2] = "补单";
				}
			}
			tGSOrderInfo[3] = tGSOrderBean.getGs_notes(); //订单备注
			tGSOrderInfo[4] = tGSOrderBean.getGs_order_status();
		}
		aForm.getRequest().setAttribute("orderinfo",tGSOrderInfo);		
		//获取订单详细信息
		GSBusOrderDetailDAO tGSBusOrderDetailDAO = new GSBusOrderDetailDAO();
		ArrayList tOrderDetails = tGSBusOrderDetailDAO.queryOrderDetail(tOrderTempID);
		aForm.getRequest().setAttribute("orderdetails",tOrderDetails);
		return GSBaseConstants.FORWARD_SUCCESS;
	}

}
